package com.zuoye.zuoye1;

public class Student implements Comparable<Student>{
    private String name;
    private int age;
    private double hight;

    public Student() {
    }

    public Student(String name, int age, double hight) {
        this.name = name;
        this.age = age;
        this.hight = hight;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public double getHight() {
        return hight;
    }

    public void setHight(double hight) {
        this.hight = hight;
    }

    @Override
    public String toString() {
        return "Student{" +
                "name='" + name + '\'' +
                ", age=" + age +
                ", hight=" + hight +
                '}';
    }

    @Override
    public int compareTo(Student o) {
        if (this.age == o.age){
            return Double.compare(o.hight, this.hight);
        }
        return this.age-o.age;
    }
}
